import { parseTableEntry } from './Table.js';


export default class Directory {
	constructor(id, name, parentID) {
		this.id = id;
		this.name = name;
		this.parentID = parentID;
	}

	static parse(biffer) {
		const entry = parseTableEntry(biffer, [
			null,
			null,
			['id', '<Q'],
			['idParent', '<Q'],
			['name', 'string'],
		]);

		return new Directory(entry.id, entry.name, entry.idParent);
	}
}